

#include <pcap.h>
#include <stdio.h>

int main()
{
  char errBuf[PCAP_ERRBUF_SIZE];
  pcap_if_t *alldev;

  printf("Libpcap Version %s\n", pcap_lib_version());

  if (pcap_findalldevs(&alldev, errBuf) == 0)
  {
    pcap_if_t *tmp = alldev;
    int i = 1;
    while (tmp)
    {
      printf("Device %d:%s\n", i++, tmp->name);
      tmp = tmp->next;
    }
  }
  else
  {
    printf("Failure!\n");
    return -1;
  }

  pcap_freealldevs(alldev);

  return 0;
}